
#include "main.h"
#include <string>
#include <stdlib.h>

Logger* logger;
Application *application;
Config* config;
Databasehandler* data; 
Protocolhandler* protocol;


std::string ws2s(std::wstring ws)
{
	const wchar_t *WStr = ws.c_str();

	size_t len = wcslen(WStr) + 1;

	size_t converted = 0;

	char *CStr;

	CStr=(char*)malloc(len*sizeof(char));

	wcstombs_s(&converted, CStr, len, WStr, _TRUNCATE);

	std::string ret(CStr);

	free(CStr);

	return ret;
}
std::wstring s2ws(std::string s)
{
	const char *CStr = s.c_str();

	size_t len = strlen(CStr) + 1;

	size_t converted = 0;

	wchar_t *WStr;

	WStr=(wchar_t*)malloc(len*sizeof(wchar_t));

	mbstowcs_s(&converted, WStr, len, CStr, _TRUNCATE);

	std::wstring ret(WStr);

	free(WStr);

	return ret;
}
int main(int argc, char **argv)
{
	application = new Application(argc,argv);
	logger = new Logger();
	int ret = application->Exec();
	delete application;
	return ret;
}


